package com.cm.service.impl;

import com.cm.domain.VO.LoginSysUser;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import jdk.nashorn.internal.objects.NativeUint8Array;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class TokenServiceImpl {

    public String createToken(LoginSysUser loginSysUser) {
        Map<String, Object> claims = new HashMap<>();
        claims.put("userAccount", loginSysUser.getUsername());
        claims.put("userPassword", loginSysUser.getPassword());
        String token = Jwts.builder().setClaims(claims)
                .signWith(SignatureAlgorithm.HS512,"admin")
                .compact();
        return token;
    }

}
